All files SigHashType.ts

100% Statements 19/19
100% Branches 14/14
100% Functions 2/2
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 171x 1x 1x 1x 1x     1x 39x 9x 8x 7x 6x 5x 4x    
export enum SigHashType {
    SIGHASH_ALL = 0x01,
    SIGHASH_NONE = 0x02,
    SIGHASH_SINGLE = 0x03,
    SIGHASH_ANYONECANPAY = 0x80,
}
 
export function isSigHashTypeValid(type: SigHashType) {
    if (type === SigHashType.SIGHASH_ALL) return true;
    if (type === SigHashType.SIGHASH_NONE) return true;
    if (type === SigHashType.SIGHASH_SINGLE) return true;
    if (type === (SigHashType.SIGHASH_ALL | SigHashType.SIGHASH_ANYONECANPAY)) return true;
    if (type === (SigHashType.SIGHASH_NONE | SigHashType.SIGHASH_ANYONECANPAY)) return true;
    if (type === (SigHashType.SIGHASH_SINGLE | SigHashType.SIGHASH_ANYONECANPAY)) return true;
    return false;
}