@@ -9,6 +9,7 @@ import { BitcoinBlockStorage } from '../../src/models/block';
99import { BitcoinBlockType } from '../../src/types/namespaces/Bitcoin/Block' ;
1010import { resetDatabase } from '../helpers/index.js' ;
1111import * as crypto from 'crypto' ;
12+ import { BitcoinTransactionType } from '../../src/types/namespaces/Bitcoin/Transaction' ;
1213
1314function randomHash ( ) {
1415 return crypto . randomBytes ( 32 ) . toString ( 'hex' ) ;
@@ -71,13 +72,13 @@ function generateBlock(blockSizeMb: number, previousBlock?: BitcoinBlockType): B
7172 return new UnspentOutput ( {
7273 txid : transaction . hash ,
7374 vout : 0 ,
74- address : output . script . toAddress ( 'mainnet' ) ,
75+ address : output . script . toAddress ( 'mainnet' ) . toString ( false ) ,
7576 scriptPubKey : output . script . toBuffer ( ) . toString ( 'hex' ) ,
7677 amount : Number ( txAmount )
7778 } ) ;
7879 } ) ;
7980 const newTx = new Transaction ( ) . from ( utxos ) ;
80- for ( const _ of newTx . inputs ) {
81+ for ( const _ of newTx . inputs ! ) {
8182 newTx . to ( newAddress ( ) , txAmount ) ;
8283 }
8384 transactions . push ( newTx ) ;
@@ -87,7 +88,7 @@ function generateBlock(blockSizeMb: number, previousBlock?: BitcoinBlockType): B
8788 const txPerMb = 2500 ;
8889 const blockSize = txPerMb * blockSizeMb ;
8990 for ( let i = 0 ; i < blockSize ; i ++ ) {
90- const newTx = new Transaction ( ) . to ( newAddress ( ) , txAmount ) ;
91+ const newTx = new Transaction ( ) . to ( newAddress ( ) , txAmount ) as BitcoinTransactionType ;
9192 block . transactions . push ( newTx ) ;
9293 }
9394 }
0 commit comments