hsd
hsd copied to clipboard
Wallet websocket covenant events
Emit websocket events for each type of covenant when the wallet indexes the transaction. This is implemented by iterating over each output in the transaction. The topic is:
${lowercase(type)} covenant
For example bid covenant
.
The payload is (walletid, namestate, details)
-
walletid
is the id of the wallet that caused the event -
namestate
is theNameState
json object -
details
is a transaction json with additional details such as the paths
Includes tests for events over websocket using bsock
.
Codecov Report
Merging #195 into master will decrease coverage by
0.1%
. The diff coverage is76%
.
@@ Coverage Diff @@
## master #195 +/- ##
==========================================
- Coverage 53.12% 53.02% -0.11%
==========================================
Files 129 129
Lines 35748 35795 +47
Branches 6022 6044 +22
==========================================
- Hits 18991 18980 -11
- Misses 16757 16815 +58
Impacted Files | Coverage Δ | |
---|---|---|
lib/wallet/txdb.js | 77.97% <68.57%> (+0.09%) |
:arrow_up: |
lib/wallet/http.js | 65.49% <93.33%> (+0.45%) |
:arrow_up: |
lib/primitives/coin.js | 67.66% <0%> (-16.55%) |
:arrow_down: |
lib/node/http.js | 47.2% <0%> (-2.1%) |
:arrow_down: |
lib/script/script.js | 58% <0%> (-1.41%) |
:arrow_down: |
lib/primitives/keyring.js | 68.96% <0%> (-0.87%) |
:arrow_down: |
lib/primitives/tx.js | 72.96% <0%> (-0.44%) |
:arrow_down: |
lib/hsd.js | 97.26% <0%> (-0.21%) |
:arrow_down: |
lib/mempool/mempool.js | 42.68% <0%> (-0.15%) |
:arrow_down: |
lib/net/framer.js | 100% <0%> (ø) |
:arrow_up: |
... and 7 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 0d5865f...b80bbc5. Read the comment docs.
As discussed out of band, I think we should emit events for tree updates as well.
PR for emitting tree updates https://github.com/handshake-org/hsd/pull/201, the node websocket topic "tree commit"
I don't think the additional i/o introduced by this PR is a problem because it first looks in the nameview
that is populated in connectNames
with a database lookup. It will only do another database lookup in the case that nameview
does not already have the name. We could add a runtime flag to disable the event emitting codepath (including the additional i/o) if we wanted to, but I don't think its necessary.
concept ACK -- I'm gonna keep this on my to-review pile and maybe we can get it into v2.4.0