In ripple-lib transaction.js function attachTransactionDate(connection, tx),
when running the script for money transfer, the tx looks smaller:
RIPPLE-LIB: TRANSACTION.js: tx { Account: 'r45NCTyFzLE72qSayEdFoU9PoZX4P71mMC',
Amount: '20000000',
Destination: 'rMqUT7uGs6Sz1m9vFr7o85XJ3WDAvgzWmj',
Fee: '12',
Flags: 2147483648,
LastLedgerSequence: 35016,
PublicKey:
'EDAC010B717FC260EB5C8D3B6FC331AD935643D14F573F64301F97C9CD7B4C4495',
Sequence: 65,
SettleDelay: 518400,
SigningPubKey:
'02945580F0BA6866B258BB670395E533527966A25358DDAA12C7A9659CBE5F2A5B',
TransactionType: 'PaymentChannelCreate',
TxnSignature:
'3044022023A5198CBB92AC2A650BD5E62CA7BE278B4A94049A009C3EC9DF62C9C81842E2022001CA244494948AA2D0A3035B133FE84E22EF95935C8F3F4BA5ECE7806AC286FE',
hash:
'195BAAA6416BCE2886C8DE730F4BB1B22EA86A6F9DF4FB65C9C245F09FCBF724' }
ndError(ledger_indexandLedgerSequencenotfoundintxxx)]
(node:5106)[DEP0079 DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
UPDATE:
Hi @kincaid @rhuairahrighairidh,
The problem comes indeed from ilp-plugin-xrp-paychan/build/utils/channel.js: it submits and immediately checks.
I added a delay to let the validators do their job.
It’s probably not an elegant solution but it made it work for now.
Thanks again for the hint.
function msleep(n) {
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, n);
}
exports.sendTransaction = async (txJSON, api, xrpSecret) => {
const { id, signedTransaction } = api.sign(txJSON, xrpSecret);
console.log('ILP_PLUGIN_XRP_PAYCHAN: send transaction: { id, signedTransaction }', { id, signedTransaction });
await api.submit(signedTransaction);
console.log('ILP_PLUGIN_XRP_PAYCHAN: CHANNEL.js: send transaction: CHECKING TX...');
msleep(10000);
const checkForTx = (attempts = 0) => api
.getTransaction(id) //ripple lib ledger transaction.js get transaction
.then(({ outcome }) => {
if (outcome.result !== 'tesSUCCESS') {
throw new Error(`Error verifying tx: ${outcome.result}`);
}
log.debug(`Transaction ${id} was included in a validated ledger`);
return outcome;
})
.catch(async (err) => {
if (attempts > 20) {
log.debug(`Failed to verify transaction, despite several attempts: ${err.message}`);
throw err;
}
else if (err.name === 'MissingLedgerHistoryError') {
await account_1.delay(200);
return checkForTx(attempts + 1);
}
else {
throw err;
}
});
return checkForTx();
};