TapSighashType::Default, ) .expect("signature hash should compute"); let sig = secp256k1.sign_schnorr( &secp256k1::Message::from_slice(sighash.as_ref()) .expect("should be cryptographically secure hash"), &key_pair, ); let witness = sighash_cache .witness_mut(commit_input) .expect("getting mutable witness reference should work"); witness.push( Signature { sig, hash_ty: TapSighashType::Default, } .to_vec(), ); witness.push(reveal_script); witness.push(&control_block.serialize()); let recovery_key_pair = key_pair.tap_tweak(&secp256k1, taproot_spend_info.merkle_root()); let (x_only_pub_key, _parity) = recovery_key_pair.to_inner().x_only_public_key(); assert_eq!( Address::p2tr_tweaked( TweakedPublicKey::dangerous_assume_tweaked(x_only_pub_key), chain.network(), ), commit_tx_address ); let reveal_weight = reveal_tx.weight(); if !self.no_limit && reveal_weight > bitcoin::Weight::from_wu(MAX_STANDARD_TX_WEIGHT.into()) {