hashForCashSignature method

dynamic hashForCashSignature (int inIndex, Uint8List prevOutScript, int amount, int hashType)

Create a hash for Bitcoin Cash signature. If this is legacy format transaction however, it will revert to the legacy signature

amount must not be null for BCH signatures

Implementation

hashForCashSignature(int inIndex, Uint8List prevOutScript, int amount, int hashType) {
  if ((hashType & SIGHASH_BITCOINCASHBIP143) > 0) {
    if (amount == null) {
      throw ArgumentError('Bitcoin Cash sighash requires value of input to be signed.');
    }

    return _hashForWitnessV0(inIndex, prevOutScript, amount, hashType);
  } else {
    return hashForSignature(inIndex, prevOutScript, hashType);
  }
}