So I would like to check if coin.out.scriptPubKey
is part of GetScriptForDestination(mypubkey.GetID())
A simple comparison isn't possible as the scriptPubKey
(when I decode it) contains only the native SegWit address while the output GetScriptForDestination()
will return all associated addresses.
Is there a nice and clean way to do this or do I need to work my way through?
GetScriptForDestination
only returns a single script, not all associated addresses (unless you're not talking about Bitcoin Core's current codebase). – Pieter Wuille Feb 7 '19 at 15:46GetScriptForDestination(mykey.GetID())
will give you the script corresponding to the P2PKH address for that key. If you want the P2WPKH address, useGetScriptForDestination(WitnessV0KeyHash(mykey.GetID()))
. GetScriptForDestination always returns just a single script, though. – Pieter Wuille Feb 8 '19 at 18:10