File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,8 @@ BigInt readVarInt(Uint8List buffer) {
176176Uint8List encodeBigIntSV (BigInt number) {
177177 int size = (number.bitLength + 7 ) >> 3 ;
178178
179+ if (size == 0 ) size = 8 ; //always padd to 64 bits if zero
180+
179181 var result = Uint8List (size);
180182 for (int i = 0 ; i < size; i++ ) {
181183 result[size - i - 1 ] = (number & _byteMask).toInt ();
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ class Sighash {
324324 writer.write (subscript.buffer);
325325
326326 // value of the output spent by this input (8-byte little endian)
327- writer.writeUint64 (satoshis. toInt (), Endian .little );
327+ writer.write ( encodeBigIntSV (satoshis) );
328328
329329 // nSequence of the input (4-byte little endian)
330330 var sequenceNumber = input.sequenceNumber;
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ class TransactionOutput {
3737 /// being used.
3838 TransactionOutput .fromReader (ByteDataReader reader) {
3939
40- this .satoshis = BigInt .from (reader.readUint64 (Endian .little));
40+ var buffer = reader.read (8 );
41+ this .satoshis = castToBigInt (buffer, false , nMaxNumSize: 8 );
4142 var size = readVarIntNum (reader);
4243 if (size != 0 ) {
4344 _script = SVScript .fromBuffer (reader.read (size, copy: true ));
You can’t perform that action at this time.
0 commit comments