-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HasTransaction returns false even when there's a matching tx in the mempool #376
Comments
I've been looking into this without success so far. I was originally suspecting an issue with the TypeScript client and possible coercion there. But no. The server is also working as expecting and the error comes from the node as far as I can tell. I've been tracing this back to the very messages sent to the node and, the node replies I've inspected the current implementation and interestingly, the server-side implements the I invite you to open a ticket on so let them know about the issue. Here's a minimal reproduction script using Ogmios on the Preview network (which assumes a const WebSocket = require('ws');
const { execSync } = require('node:child_process');
const { readFileSync } = require('node:fs');
const ADDR = readFileSync("./my.addr");
const SECRET_KEY = "./my.sk";
const SOCKET_PATH = "/tmp/node.socket";
const NETWORK_MAGIC = 2 // 0: mainnet, 1: preprod, 2: preview
const ws = new WebSocket('ws://127.0.0.1:1337');
function rpc(method, params = {}, id) {
return JSON.stringify({
jsonrpc: '2.0',
method,
params,
id
});
}
function cli(cmd, ...opts) {
const is = str => cmd.includes(str);
if (is("build") || is("query") || is("submit")) {
opts.unshift(`--socket-path ${SOCKET_PATH}`);
}
if (is("build") || is("query") || is("sign") || is("submit")) {
opts.unshift(`--testnet-magic ${NETWORK_MAGIC}`);
}
if (is("build") || is("sign")) {
opts.unshift(`--out-file /tmp/tx.cbor`);
}
if (is("txid") || is("sign") || is("submit")) {
opts.unshift(`--tx-file /tmp/tx.cbor`);
}
return execSync(`cardano-cli ${cmd} ${opts.join(" ")}`).toString();
}
let txId;
ws.on('open', () => {
const utxo = cli("query utxo", `--address ${ADDR}`);
console.log(utxo);
const utxoRef = utxo
.split("\n")[2]
.split(" ")
.map(x => x.trim())
.filter(x => x !== "");
cli("transaction build",
`--tx-in ${utxoRef[0]}#${utxoRef[1]}`,
`--change-address ${ADDR}`
);
txId = cli("transaction txid").trim();
cli("transaction sign", `--signing-key-file ${SECRET_KEY}`);
console.log(`submitting ${txId}`);
cli("transaction submit");
ws.send(rpc('acquireMempool'));
});
ws.on('message', (response) => {
const { result, error, method } = JSON.parse(response);
if (error) {
console.log(error);
ws.close();
return;
}
console.log(`${method} -> ${JSON.stringify(result)}`);
if (method === 'acquireMempool') {
ws.send(rpc('hasTransaction', { id: txId }))
} else if (method === 'hasTransaction' || result.transaction) {
ws.send(rpc('nextTransaction'));
} else {
ws.close();
}
});
ws.on('error', e => {
console.error('Oopsie', e);
process.exit(1)
}); This outputs the following:
|
I found the issue in the consensus --> IntersectMBO/ouroboros-consensus#1009 There's possibly a fix I can do in Ogmios while this gets fixed. |
What Git revision / release tag are you using?
6.0.1
Do you use any client SDK? If yes, which one?
None
Describe what the problem is?
hasTransaction
returns afalse
even though the transaction can be confirmed vianextTransaction
calls.A simple example:
The logs produced by
dbg
:What should be the expected behavior?
HasTransaction returns true when tx is in mempool
If applicable, what are the logs from the server around the occurence of the problem?
No response
The text was updated successfully, but these errors were encountered: