Skip to content

Commit

Permalink
support nonzero_unlock_time in submit tx result
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Aug 28, 2024
1 parent d96d39a commit 1efd036
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/ts/daemon/MoneroDaemonRpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,7 @@ class MoneroDaemonRpc extends MoneroDaemon {
else if (key === "status" || key === "untrusted") {} // handled elsewhere
else if (key === "top_hash") result.setTopBlockHash("" === val ? undefined : val);
else if (key === "tx_extra_too_big") result.setIsTxExtraTooBig(val);
else if (key === "nonzero_unlock_time") result.setIsNonzeroUnlockTime(val);
else console.log("WARNING: ignoring unexpected field in submit tx hex result: " + key + ": " + val);
}
return result;
Expand Down
10 changes: 10 additions & 0 deletions src/main/ts/daemon/model/MoneroSubmitTxResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class MoneroSubmitTxResult {
credits: bigint;
topBlockHash: string;
isTxExtraTooBig: boolean;
isNonzeroUnlockTime: boolean;

constructor(result?: Partial<MoneroSubmitTxResult>) {
Object.assign(this, result);
Expand Down Expand Up @@ -164,4 +165,13 @@ export default class MoneroSubmitTxResult {
this.isTxExtraTooBig = isTxExtraTooBig;
return this;
}

getIsNonzeroUnlockTime(): boolean {
return this.isNonzeroUnlockTime;
}

setIsNonzeroUnlockTime(isNonzeroUnlockTime: boolean): MoneroSubmitTxResult {
this.isNonzeroUnlockTime = isNonzeroUnlockTime;
return this;
}
}
1 change: 1 addition & 0 deletions src/test/TestMoneroDaemonRpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,7 @@ function testSubmitTxResultGood(result: MoneroSubmitTxResult) {
assert.equal(result.getTopBlockHash(), undefined);
assert.equal(result.getIsTxExtraTooBig(), false);
assert.equal(result.getIsGood(), true);
assert.equal(result.getIsNonzeroUnlockTime(), false);
} catch (e) {
console.log("Submit result is not good: " + JSON.stringify(result.toJson()));
throw e;
Expand Down

0 comments on commit 1efd036

Please sign in to comment.