1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2025-01-09 15:20:55 +00:00

CH12: replace std tx policy with only consensus tx rules

The previous list mixed consensus rules that transaction must follow
with standard transaction policy, which I think was confusng for readers
and also a problem in a later reference where we claim that all
transactions in a block must follow the rules (true for consensus; false
for policy).
This commit is contained in:
David A. Harding 2023-05-25 13:06:47 -10:00
parent cb15241574
commit 4fa8a1590c

View File

@ -321,55 +321,28 @@ criteria:
- Neither lists of inputs or outputs are empty. - Neither lists of inputs or outputs are empty.
- The transaction size in bytes is less than +MAX_BLOCK_SIZE+. - The transaction weight is less than the maximum block weight
limit.
- Each output value, as well as the total, must be within the allowed - Each output value, as well as the total, must be within the allowed
range of values (less than 21m coins, more than the _dust_ threshold). range of values (zero or more, but less than 21m coins).
- None of the inputs have hash=0, N=1 (coinbase transactions should not
be relayed).
- +nLocktime+ is equal to +INT_MAX+, or +nLocktime+ and +nSequence+ - +nLocktime+ is equal to +INT_MAX+, or +nLocktime+ and +nSequence+
values are satisfied according to +MedianTimePast+. values are satisfied according to the locktime and BIP68 rules.
- The transaction size in bytes is greater than or equal to 100.
- The number of signature operations (SIGOPS) contained in the - The number of signature operations (SIGOPS) contained in the
transaction is less than the signature operation limit. transaction is less than the signature operation limit.
- The unlocking script (+scriptSig+) can only push numbers on the stack, - The outputs being spent match outputs in the mempool or unspent
and the locking script (+scriptPubkey+) must match +IsStandard+ forms outputs in a block in the main branch.
(this rejects "nonstandard" transactions).
- A matching transaction in the pool, or in a block in the main branch,
must exist.
- For each input, if the referenced output exists in any other
transaction in the pool, the transaction must be rejected.
- For each input, look in the main branch and the transaction pool to
find the referenced output transaction. If the output transaction is
missing for any input, this will be an orphan transaction. Add to the
orphan transactions pool, if a matching transaction is not already in
the pool.
- For each input, if the referenced output transaction is a coinbase - For each input, if the referenced output transaction is a coinbase
output, it must have at least +COINBASE_MATURITY+ (100) confirmations. output, it must have at least +COINBASE_MATURITY+ (100) confirmations.
- For each input, the referenced output must exist and cannot already be
spent.
- Using the referenced output transactions to get input values, check
that each input value, as well as the sum, are in the allowed range of
values (less than 21m coins, more than 0).
- Reject if the sum of input values is less than sum of output values. - Reject if the sum of input values is less than sum of output values.
- Reject if transaction fee would be too low (+minRelayTxFee+) to get - The scripts for each input must validate against the
into an empty block. corresponding output scripts.
- The unlocking scripts for each input must validate against the
corresponding output locking scripts.
These conditions can be seen in detail in the functions These conditions can be seen in detail in the functions
+AcceptToMemoryPool+, +CheckTransaction+, and +CheckInputs+ in Bitcoin +AcceptToMemoryPool+, +CheckTransaction+, and +CheckInputs+ in Bitcoin