Open egieseke opened 2 years ago
Could you provide a code sample?
Here's an example showing the failure:
@Test
public void TxnZeroFeeEncodeDecode() throws Exception {
Transaction tx = Transaction.PaymentTransactionBuilder()
.sender(DEFAULT_ACCOUNT.getAddress())
.flatFee(0)
.firstValid(1)
.lastValid(10)
.amount(1)
.genesisHash(new Digest())
.receiver(DEFAULT_ACCOUNT.getAddress())
.build();
assertThat(tx.fee).isEqualTo(0);
String encoded2 = Encoder.encodeToJson(tx);
Transaction jsonTxn = Encoder.decodeFromJson(encoded2, Transaction.class);
assertThat(jsonTxn.fee).isEqualTo(0);
byte[] encoded = Encoder.encodeToMsgPack(tx);
Transaction msgpTxn = Encoder.decodeFromMsgPack(encoded, Transaction.class);
assertThat(msgpTxn.fee).isEqualTo(0);
}
This might solve the issue
Subject of the issue
Fix Transaction Java serialization to preserve the fee value. In group transactions, fees can be paid by a single party in the transaction, so it is important to be able to specify a 0 transaction fee for other parties.
Your environment
Java SDK v 1.14.0
Steps to reproduce
Expected behavior
The transaction fee should remain what was set.
Actual behavior
The transaction fee is reset to 1000 after serialization/deserialization, the set value is lost.