KomodoPlatform / zebra

An ongoing Rust implementation of a Komodo node. 🦓
Apache License 2.0
3 stars 5 forks source link

Fix 'is final tx' rule for komodo s1 december hardfork condition #23

Closed dimxy closed 1 year ago

dimxy commented 1 year ago

See komodo IsFinalTx with komodo_hardfork_active() function use (which is actually s1 hardfork)

DeckerSU commented 1 year ago

Few useful links about IsFinalTx, CLTV, nSequence:

DeckerSU commented 1 year ago

Wrote a test for IsFinalTx for komodod, for now it exists only in KomodoOcean repo in patch-test-isfinaltx branch, if needed we can do PR in komodod repo. All tests made in one file - test_isfinaltx.cpp. Same behavior we should have in Zebra.

DeckerSU commented 1 year ago

It looks like the changes are ready and can be found in the patch-isfinaltx branch. We will no longer be using lock_time_has_passed/ tx.lock_time() because this method is not clear as it returns a value based on certain conditions. Instead, we will be using a new function called is_final_tx_komodo, which is a step-by-step replication of the IsFinalTx function from komodod and uses the previously introduced tx.raw_lock_time() to read the "raw" nLockTime field. All possible cases have been covered in the tests.