simulator nLockTime

This commit is contained in:
scgbckbone 2024-10-13 07:18:14 +02:00
parent 4a234e8452
commit f920020ba0
2 changed files with 5 additions and 4 deletions

View File

@ -83,7 +83,8 @@ class CCCFeature:
# a very basic and permissive policy, but non-zero too.
# - 1BTC per day
chain = chains.current_chain()
return dict(mag=1, vel=144, block_h=chain.ccc_min_block, web2fa='', addrs=[])
return dict(mag=1, vel=144, block_h=chain.CCC_MIN_BLOCK,
web2fa='', addrs=[])
@classmethod
def get_policy(cls):
@ -145,11 +146,11 @@ class CCCFeature:
# this is unix timestamp - not allowed - fail
raise CCCPolicyViolationError("nLockTime not height")
block_h = pol.get("block_h", chains.current_chain().ccc_min_block)
block_h = pol.get("block_h", chains.current_chain().CCC_MIN_BLOCK)
if psbt.lock_time <= block_h:
raise CCCPolicyViolationError("rewound")
# we wont sign txn unless old height + velocity >= new height
# we won't sign txn unless old height + velocity >= new height
if psbt.lock_time < (block_h + velocity):
raise CCCPolicyViolationError("velocity")

View File

@ -34,7 +34,7 @@ class ChainsBase:
curve = 'secp256k1'
menu_name = None # use 'name' if this isn't defined
core_name = None # name of chain's "core" p2p software
ccc_min_block = 0 # block height at which CCC feature was developed
CCC_MIN_BLOCK = 0 # block height at which CCC feature was developed
# b44_cointype comes from
# <https://github.com/satoshilabs/slips/blob/master/slip-0044.md>