sign method
      
  
LegacyInput
sign({ 
    
- required Transaction tx,
- required int inputN,
- required ECPrivateKey key,
- SigHashType hashType = const SigHashType.all(),
override
    Signs the input given the tx, input number (inputN) and a private
key using the specifified hashType.
Implemented by specific subclasses.
Implementation
@override
LegacyInput sign({
  required Transaction tx,
  required int inputN,
  required ECPrivateKey key,
  hashType = const SigHashType.all(),
}) {
  if (!program.pubkeys.contains(key.pubkey)) {
    throw CannotSignInput("Key doesn't exist for multisig input");
  }
  return insertSignature(
    createInputSignature(
      tx: tx,
      inputN: inputN,
      key: key,
      scriptCode: program.script,
      hashType: hashType,
    ),
    key.pubkey,
    (hashType) => LegacySignatureHasher(
      tx: tx,
      inputN: inputN,
      scriptCode: program.script,
      hashType: hashType,
    ).hash,
  );
}