Skip to content

Commit

Permalink
fix: handle FEE_SCHEDULE_FILE_PART_UPLOADED status (#1967)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Ivanov <ivanivanov.ii726@gmail.com>
  • Loading branch information
0xivanov authored Aug 28, 2024
1 parent e231290 commit 5a37d2f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public static TransactionReceipt fromBytes(byte[] bytes) throws InvalidProtocolB
* @throws ReceiptStatusException when shouldValidate is true and the transaction status is not SUCCESS
*/
public TransactionReceipt validateStatus(boolean shouldValidate) throws ReceiptStatusException {
if (shouldValidate && status != Status.SUCCESS) {
if (shouldValidate && status != Status.SUCCESS && status != Status.FEE_SCHEDULE_FILE_PART_UPLOADED) {
throw new ReceiptStatusException(transactionId, this);
}
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
package com.hedera.hashgraph.sdk.test.integration;

import com.google.errorprone.annotations.Var;
import com.hedera.hashgraph.sdk.AccountId;
import com.hedera.hashgraph.sdk.FileCreateTransaction;
import com.hedera.hashgraph.sdk.FileDeleteTransaction;
import com.hedera.hashgraph.sdk.FileId;
import com.hedera.hashgraph.sdk.FileInfoQuery;
import com.hedera.hashgraph.sdk.FileUpdateTransaction;
import com.hedera.hashgraph.sdk.KeyList;
import com.hedera.hashgraph.sdk.PrecheckStatusException;
import com.hedera.hashgraph.sdk.PrivateKey;
import com.hedera.hashgraph.sdk.ReceiptStatusException;
import com.hedera.hashgraph.sdk.Status;
import org.junit.jupiter.api.DisplayName;
Expand Down Expand Up @@ -130,4 +133,22 @@ void cannotUpdateFileWhenFileIDIsNotSet() throws Exception {

testEnv.close();
}

@Test
@DisplayName("Can update fee schedule file")
void canUpdateFeeScheduleFile() throws Exception {
var testEnv = new IntegrationTestEnv(1);
testEnv.client.setOperator(new AccountId(0, 0, 2), PrivateKey.fromString(
"302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"));

var fileId = new FileId(0, 0, 111);
var receipt = new FileUpdateTransaction()
.setFileId(fileId)
.setContents("[e2e::FileUpdateTransaction]")
.execute(testEnv.client)
.getReceipt(testEnv.client);

assertThat(receipt.status).isEqualTo(Status.FEE_SCHEDULE_FILE_PART_UPLOADED);
testEnv.close();
}
}

0 comments on commit 5a37d2f

Please sign in to comment.