Page MenuHomePhabricator

[token-server] Add function hasInputsFromOutputScript
ClosedPublic

Authored by bytesofman on Mar 4 2024, 21:17.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Commits
rABC3eed55c5ca13: [token-server] Add function hasInputsFromOutputScript
Summary

Add a function to determine if a given tx includes inputs from a given outputScript

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bytesofman published this revision for review.Mar 4 2024, 21:33

I assume txs like this self minting tx are out of scope for this token server right? The function will return false as the minter won't be in the inputs but I guess this wouldn't be generated out of cashtab anyway yea?

I assume txs like this self minting tx are out of scope for this token server right? The function will return false as the minter won't be in the inputs but I guess this wouldn't be generated out of cashtab anyway yea?

Edge cases where a tx might still be technically "from" some unlisted outputScript are possible. I've tried to be explicit as possible with the function naming, with hasInputsFromOutputScript

the decision on whether or not this is an appropriate test would depend on the use of the function. Check out D15599 to see where this is going.

For the purposes of this function, we are checking if the token was sent from a hot wallet on the server. So, it will work for that. If we use self minting at some point, we would need some other kind of test.

This revision is now accepted and ready to land.Mar 5 2024, 22:12