@@ -53,7 +53,7 @@ describe('bitcoinjs-lib (transaction with taproot)', () => {
53
53
const internalKey = bip32 . fromSeed ( rng ( 64 ) , regtest ) ;
54
54
const p2pkhKey = bip32 . fromSeed ( rng ( 64 ) , regtest ) ;
55
55
56
- const { output, address } = bitcoin . payments . p2tr ( {
56
+ const { output } = bitcoin . payments . p2tr ( {
57
57
internalPubkey : toXOnly ( internalKey . publicKey ) ,
58
58
network : regtest ,
59
59
} ) ;
@@ -84,7 +84,17 @@ describe('bitcoinjs-lib (transaction with taproot)', () => {
84
84
} ) ;
85
85
psbt . addInput ( { index : 0 , hash : p2pkhUnspent . txId , nonWitnessUtxo } ) ;
86
86
87
- psbt . addOutput ( { value : sendAmount , address : address ! } ) ;
87
+ const sendInternalKey = bip32 . fromSeed ( rng ( 64 ) , regtest ) ;
88
+ const sendPubKey = toXOnly ( sendInternalKey . publicKey ) ;
89
+ const { address : sendAddress } = bitcoin . payments . p2tr ( {
90
+ internalPubkey : sendPubKey ,
91
+ network : regtest ,
92
+ } ) ;
93
+
94
+ psbt . addOutput ( {
95
+ value : sendAmount ,
96
+ tapInternalKey : sendPubKey ,
97
+ } ) ;
88
98
89
99
const tweakedSigner = tweakSigner ( internalKey ! , { network : regtest } ) ;
90
100
await psbt . signInputAsync ( 0 , tweakedSigner ) ;
@@ -99,7 +109,7 @@ describe('bitcoinjs-lib (transaction with taproot)', () => {
99
109
await regtestUtils . broadcast ( hex ) ;
100
110
await regtestUtils . verify ( {
101
111
txId : tx . getId ( ) ,
102
- address : address ! ,
112
+ address : sendAddress ! ,
103
113
vout : 0 ,
104
114
value : sendAmount ,
105
115
} ) ;
0 commit comments