libra-core
libra-core copied to clipboard
client.getAccountTransaction results in an error
this code worked on 2019-09-01, but now I get an error.
code test-tx.js
const libracore =require('libra-core')
const client = new libracore.LibraClient({ network: libracore.LibraNetwork.Testnet });
const accountAddress = '7f58df27522872ecfac340c5c072427e6f8083ca3c79bb748cdd1ae073dacc42';
const sequenceNumber = 43; //can also use a string for really large sequence numbers;
const transaction = client.getAccountTransaction(accountAddress, sequenceNumber);
Run
node test-tx.js
Error
/home/tato/kabuda.net/html/test/libra/libra-core/node_modules/libra-core/build/client/Decoder.js:39
const signedTransaction = signedTransactionWP.getSignedTransaction();
^
TypeError: Cannot read property 'getSignedTransaction' of undefined
at ClientDecoder.decodeSignedTransactionWithProof (/home/tato/kabuda.net/html/test/libra/libra-core/node_modules/libra-core/build/client/Decoder.js:39:55)
at /home/tato/kabuda.net/html/test/libra/libra-core/node_modules/libra-core/build/client/index.js:109:38
at Object.onReceiveStatus (/home/tato/kabuda.net/html/test/libra/libra-core/node_modules/grpc/src/client_interceptors.js:1207:9)
at InterceptingListener._callNext (/home/tato/kabuda.net/html/test/libra/libra-core/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/home/tato/kabuda.net/html/test/libra/libra-core/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/home/tato/kabuda.net/html/test/libra/libra-core/node_modules/grpc/src/client_interceptors.js:845:24)
Maybe this testnet-update-september-4th effect? https://community.libra.org/t/testnet-update-september-4th/1630
- [crypto] Switches LedgerInfo to nextgen_crypto #373 https://github.com/libra/libra/pull/373 21
- [crypto] Changes
types::SignedTransaction
to use the nextgen crypto API #429 https://github.com/libra/libra/pull/429 17 - [crypto] apply nextgen_crypto x25519 across Libra #464 https://github.com/libra/libra/pull/464 13
- [storage][execution] Switch to Jellyfish Merkle Tree #516 https://github.com/libra/libra/pull/516 11
- [common] Add Canonical Serialization Spec #622 https://github.com/libra/libra/pull/622 9
- Use CanonicalSerialization of RawTransaction between client and validator #606 https://github.com/libra/libra/pull/606 17
The Libra testnet was reset. There are no old transactions. I took the address from your sample, and the current sequence number is zero.
This exception you are seeing is because the getSignedTransaction() method does not check if the returned GRPC call contains a valid signedTransactionWP, and it winds up getting a null-value. If it checked for null, it could return an error and not an exception.
You can see the lack of transactions on that address using LibExplorer: https://libexplorer.com/address/7f58df27522872ecfac340c5c072427e6f8083ca3c79bb748cdd1ae073dacc42
The testnet update does appear to break the current libra-core, and you can't perform any transactions at the moment.
@glachac Thank you for your advice.
I watched LibExplorer. Certainly, there are no transactions. I tried to create a sequence by transferring after minting with another address for trial, but I couldn't. I can mint.
I have a PR with a fix for this now.