# All files SigHashType.ts

31.58% Statements 6/19
14.29% Branches 2/14
50% Functions 1/2
37.5% Lines 6/16

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
    17
    18
    19
    201x
    1x
    1x
    1x
    1x

    1x

     export enum SigHashType {
      SIGHASH_ALL = 0x01,
      SIGHASH_NONE = 0x02,
      SIGHASH_SINGLE = 0x03,
      SIGHASH_ANYONECANPAY = 0x80,
    }

    export function isSigHashTypeValid(type: SigHashType): boolean {
      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;
    }