lbryio / lbrycrd

The blockchain that provides the digital content namespace for the LBRY protocol
https://lbry.com
MIT License
2.57k stars 178 forks source link

RPC calls ignore locktime transactions #370

Open BrannonKing opened 4 years ago

BrannonKing commented 4 years ago

Enable address decode and "is mine" for transactions containing the OP_CHECKLOCKTIMEVERIFY and OP_CHECKSEQUENCEVERIFY prefixes.

I'm not sure if should report something as spendable when the timelock has not yet elapsed, but we should afterward. Right now the "watch only" flag is required to see these.

BrannonKing commented 4 years ago

listreceivedbyaddress shows them if you run importaddress on the redeemscript.

In reviewing the code again, multisig addresses are not considered non-standard. They are first-class citizens. Therefore the "is mine" code correctly handles them. The timelock stuff, on the other hand, falls down the "nonstandard transaction" path. Therefore, it is only monitored if it is explicitly marked as "watch only".

So that leaves three options:

  1. Make the timelock scripts first-class citizens.
  2. Automatically add them as "watch only" scripts in addtimelockedaddress.
  3. Rely on somebody who cares to call importaddress on the redeemscript. Option 1 is more involved. Option 3 requires no work. Option 2 and 3 rely on the "watch only" stuff.