Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change min tx size in bytes #216

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ErrStatusInputs: Either the input satoshis sum is too high, or there are no inpu
ErrStatusOutputs: Transaction is invalid because the outputs are non-existent or attempting to create a non-zero false return output, or satoshi values greater than max value.

# 464
ErrStatusMalformed: Either the transaction is too small (100 bytes min), there are too many sig ops, or there is a non-data push in the unlocking script.
ErrStatusMalformed: Either the transaction is too small (61 bytes min), there are too many sig ops, or there is a non-data push in the unlocking script.

# 465
ErrStatusFees: The fees are too low, sum satoshis out is not less than sum satoshis in.
Expand All @@ -32,4 +32,4 @@ Conflict: Transaction is invalid because the network has already seen a tx which
ErrStatusFrozenPolicy: Input Frozen (blacklist manager policy blacklisted). The transaction is attempting to spend frozen digital assets.

# 482
ErrStatusFrozenConsensus: Input Frozen (blacklist manager consensus blacklisted) The transaction is attempting to spend frozen digital assets.
ErrStatusFrozenConsensus: Input Frozen (blacklist manager consensus blacklisted) The transaction is attempting to spend frozen digital assets.
15 changes: 9 additions & 6 deletions validator/default/default_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ import (
)

// MaxBlockSize is set dynamically in a node, and should be gotten from the policy
const MaxBlockSize = 4 * 1024 * 1024 * 1024
const MaxSatoshis = 21_000_000_00_000_000
const coinbaseTxID = "0000000000000000000000000000000000000000000000000000000000000000"
const MaxTxSigopsCountPolicyAfterGenesis = ^uint32(0) // UINT32_MAX
const (
MaxBlockSize = 4 * 1024 * 1024 * 1024
MaxSatoshis = 21_000_000_00_000_000
coinbaseTxID = "0000000000000000000000000000000000000000000000000000000000000000"
MaxTxSigopsCountPolicyAfterGenesis = ^uint32(0) // UINT32_MAX
minTxSizeBytes = 61
)

type DefaultValidator struct {
policy *bitcoin.Settings
Expand Down Expand Up @@ -69,8 +72,8 @@ func (v *DefaultValidator) ValidateTransaction(tx *bt.Tx, skipFeeValidation bool
// => checked by the node, we do not want to have to know the current block height

// 7) The transaction size in bytes is greater than or equal to 100
if txSize < 100 {
return validator.NewError(fmt.Errorf("transaction size in bytes is less than 100 bytes"), api.ErrStatusMalformed)
if txSize < minTxSizeBytes {
return validator.NewError(fmt.Errorf("transaction size in bytes is less than %d bytes", minTxSizeBytes), api.ErrStatusMalformed)
}

// 8) The number of signature operations (SIGOPS) contained in the transaction is less than the signature operation limit
Expand Down
Loading