0

On regtest, I can use generateblock to successfully a mine transaction i.e containing an input with nSequence (0x05000000), although the input has not reached the specified age (5 confirmations). Though I get non-BIP68-final (code -26) error when I use sendrawtransaction. Wondering why this is the case.

Here's how I do it:

For easy demonstration I fund OP_TRUE (decodescript 51). It gives me p2wsh address: bcrt1qft5p2uhsdcdc3l2ua4ap5qqfg4pjaqlp250x7us7a8qqhrxrxfsqseac85.

Then I fund this address 1000 sats: TXID: a21c3ccc203f0c30c613e4409b011e5753ca10bb93fe5036849ab87e14e4cb6c, VOUT: 1.

Then I mine this funding transaction:

generateblock 2N1AwW2Jv4NcsgBWwggDPN7PLx4MpgRNjhs '["a21c3ccc203f0c30c613e4409b011e5753ca10bb93fe5036849ab87e14e4cb6c"]'

Then I manually construct a raw tx spending this input with witness 0x51, with nSequence 0x02000000:

020000000001016ccbe4147eb89a843650fe93bb10ca53571e019b40e413c6300c3f20cc3c1ca201000000000200000001f4010000000000002251209bb9efbddf9d70afd3ac2cef011747236bdf90832a78b08f57d1139f07aa918501015100000000

sendrawtransaction 020000000001016ccbe4147eb89a843650fe93bb10ca53571e019b40e413c6300c3f20cc3c1ca201000000000200000001f4010000000000002251209bb9efbddf9d70afd3ac2cef011747236bdf90832a78b08f57d1139f07aa918501015100000000 gives me the error: “non-BIP68-final (code -26)”

However,

generateblock 2N1AwW2Jv4NcsgBWwggDPN7PLx4MpgRNjhs '["020000000001016ccbe4147eb89a843650fe93bb10ca53571e019b40e413c6300c3f20cc3c1ca201000000000200000001f4010000000000002251209bb9efbddf9d70afd3ac2cef011747236bdf90832a78b08f57d1139f07aa918501015100000000"]' successfully mines the block:

{
  "hash": "0f63ae01726730e186a5a8e16c2b4f9673ce135c46d033f8c60ee636319ffa6a"
}
Burak
  • 186
  • 6

1 Answers1

3

Transaction validity rules applied to the mempool/unconfirmed transactions are static; they include all known softforks, for example, independent of whether those are (already) active on the chain. This simplifies mempool reasoning around the time softforks activate, as the alternative would mean the mempool needs to be re-evaluated every time rules change.

On regtest it is possible to operate in a state where the BIP68 software isn't active from the very beginning. What does getdeploymentinfo say under "csv"?

Pieter Wuille
  • 105,497
  • 9
  • 194
  • 308
  • I've upgraded to v23.0.0 from v22.0.0. Now I get TestBlockValidity failed: bad-txns-nonfinal (code -25) error. Thank you! – Burak Nov 08 '22 at 21:36
  • 2
    Prior to 23.0, CSV would activate after height 432. In 23.0 and later, all soft forks are set to always be active, although this can be overridden in configuration. – Ava Chow Nov 08 '22 at 21:45