You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Account Update transaction sets the receiver signature required field to false if setReceiverSignatureRequired is not called.
This is problematic if we want to track the changes in an account.
Imagine we have an account with the receiver signature required set to true and we want to update the key of the account.
We create an Account Update transaction and only invoke setKey.
After executed the key is correctly updated, but the receiver signature required is now set to false
Steps to reproduce
Paste this snippet
const{
AccountCreateTransaction,
AccountId,
AccountInfoQuery,
AccountUpdateTransaction,
Client,
Hbar,
PrivateKey,}=require('@hashgraph/sdk');asyncfunctionrun(){constpayerId=AccountId.fromString('');constpayerPrivateKey=PrivateKey.fromStringED25519('');//Testnet private keyconstclient=Client.forTestnet();client.setOperator(payerId,payerPrivateKey);client.setDefaultMaxTransactionFee(newHbar(100));letcreateTx=awaitnewAccountCreateTransaction().setKey(payerPrivateKey.publicKey).setReceiverSignatureRequired(true).freezeWith(client);constresponse=awaitcreateTx.execute(client);constreceipt=awaitresponse.getReceipt(client);constnewAccountId=receipt.accountId;console.log('The new account ID is:',newAccountId.toString());letaccountInfo=awaitnewAccountInfoQuery().setAccountId(newAccountId).execute(client);console.log('After create, the account receiver sig required is:',accountInfo.isReceiverSignatureRequired);// This should be trueawait(await(awaitnewAccountUpdateTransaction().setAccountId(newAccountId).freezeWith(client)).execute(client)).getReceipt(client);accountInfo=awaitnewAccountInfoQuery().setAccountId(newAccountId).execute(client);console.log('After update, the account receiver sig required is:',accountInfo.isReceiverSignatureRequired);// This should be trueif(accountInfo.isReceiverSignatureRequired!==true){console.error('SDK BUG: Account receiver sig required is updated even though it was not set in the update transaction');}client.close();}run();
Fill the private key & payer
Run the snippet
Additional context
No response
Hedera network
No response
Version
2.49.2
Operating system
None
The text was updated successfully, but these errors were encountered:
Description
Account Update transaction sets the receiver signature required field to
false
ifsetReceiverSignatureRequired
is not called.This is problematic if we want to track the changes in an account.
Imagine we have an account with the receiver signature required set to
true
and we want to update the key of the account.We create an Account Update transaction and only invoke
setKey
.After executed the key is correctly updated, but the receiver signature required is now set to
false
Steps to reproduce
Additional context
No response
Hedera network
No response
Version
2.49.2
Operating system
None
The text was updated successfully, but these errors were encountered: