File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
src/Serialization/TransactionBody Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ export class TransactionBody {
107
107
writer . writeEncodedValue ( hexToBytes ( this . #inputs. toCbor ( ) ) ) ;
108
108
}
109
109
110
- if ( this . #outputs !== undefined && this . #outputs . length > 0 ) {
110
+ if ( this . #outputs !== undefined ) {
111
111
writer . writeInt ( 1n ) ;
112
112
writer . writeStartArray ( this . #outputs. length ) ;
113
113
@@ -421,7 +421,7 @@ export class TransactionBody {
421
421
treasuryValue : this . #currentTreasuryValue,
422
422
update : this . #update ? this . #update. toCore ( ) : undefined ,
423
423
validityInterval :
424
- this . #ttl || this . #validityStartInterval !== undefined
424
+ this . #ttl !== undefined || this . #validityStartInterval !== undefined
425
425
? {
426
426
invalidBefore : this . #validityStartInterval,
427
427
invalidHereafter : this . #ttl
@@ -968,7 +968,7 @@ export class TransactionBody {
968
968
let mapSize = 0 ;
969
969
970
970
if ( this . #inputs !== undefined && this . #inputs. size ( ) > 0 ) ++ mapSize ;
971
- if ( this . #outputs !== undefined && this . #outputs . length > 0 ) ++ mapSize ;
971
+ if ( this . #outputs !== undefined ) ++ mapSize ;
972
972
if ( this . #fee !== undefined ) ++ mapSize ;
973
973
if ( this . #ttl !== undefined ) ++ mapSize ;
974
974
if ( this . #certs !== undefined && this . #certs. size ( ) > 0 ) ++ mapSize ;
Original file line number Diff line number Diff line change @@ -143,4 +143,13 @@ describe('Transaction', () => {
143
143
'2d7f290c815e061fb7c27e91d2a898bd7b454a71c9b7a26660e2257ac31ebe32'
144
144
) ;
145
145
} ) ;
146
+
147
+ it ( 'can roundtrip tx with ttl 0 and no outputs' , ( ) => {
148
+ const cbor = TxCBOR (
149
+ '84a700818258200000000000000000000000000000000000000000000000000000000000000000000180020003000758203f5c96d4e519a27e7e62d3e19c05aa352431fccc60fc2255e7d479a2bf1a01110e81581cf120862e979a660a8a068485a930e78de8a5804aff7612895b1f77250f01a0f5a10075544f444f3a2046494c4c20494e204d455353414745'
150
+ ) ;
151
+ const tx = Transaction . fromCbor ( cbor ) . toCore ( ) ;
152
+
153
+ expect ( Transaction . fromCore ( tx ) . toCbor ( ) ) . toBe ( cbor ) ;
154
+ } ) ;
146
155
} ) ;
You can’t perform that action at this time.
0 commit comments