applySignedRaw method

dynamic applySignedRaw(
  1. int vin,
  2. Uint8List signature, {
  3. int? hashType,
})

Implementation

dynamic applySignedRaw(int vin, Uint8List signature, {int? hashType}) async {
   var signed = false;
   final input = _inputs![vin];
   hashType = hashType ?? SIGHASH_ALL;
  for (var i = 0; i < input.pubkeys!.length; i++) {
    // if (HEX.encode(ourPubKey!).compareTo(HEX.encode(input.pubkeys![i]!)) != 0) continue;
    if (input.signatures![i] != null) throw ArgumentError('Signature already exists');
    input.signatures![i] = signature;
    signed = true;
  }

  if (!signed) throw ArgumentError('Key pair cannot sign for this input');
}