signSchnorrHd method

void signSchnorrHd({
  1. required int vin,
  2. required Uint8List sig,
  3. int? hashType,
})

Implementation

void signSchnorrHd(
    {required int vin, required Uint8List sig, int? hashType}) {
  if (vin >= ins.length) throw ArgumentError('No input at index: $vin');

  hashType = hashType ?? SIGHASH_DEFAULT;
  final input = ins[vin];

  final witness = [_serializeTaprootSignature(sig, hashType)];
  if (input.tapLeafScript?.isNotEmpty ?? false) {
    final item = input.tapLeafScript!.first;
    witness.addAll([item.script, item.controlBlock]);
  }

  input.update(witness: witness);
}