Function decodeSignature
Decodes the raw byte representation of a signature to its
Signature
and SigHash
parts, and validates the SigHash
to be one of the known flags or accepted combination of flags.
string decodeSignature
(
const(ubyte)[] bytes,
out SigPair sig_pair,
out ulong pop_count
) pure nothrow @nogc @safe;
Parameters
Name | Description |
---|---|
bytes | contains the |
sig_pair | will contain the signature tuple if the Signature was encoded correctly and the SigHash is one of the known flags or accepted combination of flags. |
pop_count | amount of bytes consumed |
Returns
null if the signature tuple was decoded correctly, otherwise the string explaining the reason why if decoding failed
Example
assert(!isValidSigHash(cast(SigHash)0));
assert(isValidSigHash(SigHash .All));
assert(isValidSigHash(SigHash .NoInput));
assert(isValidSigHash(SigHash .Single));
assert(!isValidSigHash(SigHash .AnyoneCanPay));
// this combo is unrecognized
assert(!isValidSigHash(cast(SigHash)(SigHash .All | SigHash .NoInput)));
assert(isValidSigHash(SigHash .Single_NoInput_AnyoneCanPay));
assert(isValidSigHash(SigHash .OmitSingle));
assert(isValidSigHash(SigHash .OmitSingle_NoInput_AnyoneCanPay));
assert(!isValidSigHash(cast(SigHash)(SigHash .OmitSingle | SigHash .Single)));