Closed dgpv closed 6 months ago
Is this safe to do for arbitrary input ? Could it be possible that an input might be spendable regardless of the fact that its witness version and witness program size violates these restrictions ? I cannot think of any such possibilities, but need to check that to make sure.
No need to model SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM
. Output sciptpubkeys are also not restricted by fRequireStandard=True
, because IsStandard()
does not treat TxoutType::WITNESS_UNKNOWN
as non-standard.
so these restrictions are only applicable for inptus in non-miner mode
Right now they are not restricted, but actually they will be restricted in practice.
Output witness version and scriptpubkey size will be restricted by standardness check called in
IsStandardTx()
Input witness version and scriptpubkey size will be restricted byVerifyWitnessProgram()
checking them, and acting onSCRIPT_ERR_DISCOURAGE_UPGRADABLE_*
flag values, which will be set for the non-miner.It might be not entirely correct to add
--discourage-upgradable-witness-program-flag
setting, because unlike for inputs, the output witness version and scriptpubkey length restriction in the reference source do not depend on that flag, but rather on thefRequireStandard
boolean variable.Might just set these restrictions for
--is-miner=false
and add a note to README thatSCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM
is not referenced exactly, but the behavior is modeled via--is-miner
setting.