Skip to content
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

[feature request] Extend Bloom Filter support to InstantSend related messages #1677

Closed
HashEngineering opened this issue Oct 10, 2017 · 1 comment

Comments

@HashEngineering
Copy link

HashEngineering commented Oct 10, 2017

Objective
The idea is to extend BlP37 (Bloom Filters) to support all InstantSend related messages ("ix" and "txlvote"). Dash Core already supports Bloom Filters for regular transactions.

Reasoning
The benefit is to reduce network traffic to SPV (or filtered nodes). The current Dash Wallet for android is aware of the "ix" and "txlvote" messages and it listens for them to add InstantSend transactions to its wallet as they are received and to know if the masternode quarum validates InstantSend transactions (sent and received). Dash Wallet uses dashj as the layer that interfaces with the Dash P2P Network. Other apps may use dashj or have their own implementations that could benefit.

What Needs to be Added to Dash Core
There would be two new messages to cover - both of which are announced to peers using "inv" messages. The peers receive "inv" messages, then request data they don't have with "getdata".

  1. "ix"
  2. "txlvote"

IX("ix") [Already done]
From RelayTransaction we can see that bloom filters are used with InstantSend transactions as they are with PrivateSend and regular transactions:
https://github.com/dashpay/dash/blob/master/src/net.cpp#L2102

Therefore I would say no changes are needed with "ix".

Transaction Lock Votes ("txlvote")
It appears that transaction lock votes are generated by masternodes and then relayed or they received by a node and relayed to other peers with an "inv" message. This is done first by CTxLockVote::Relay() which calls RelayInv found here: https://github.com/dashpay/dash/blob/master/src/net.cpp#L2136. As one can see, RelayInv does not use any filters to determine what applies to each node. PushInventory is called on each peer and is found here: https://github.com/dashpay/dash/blob/master/src/net.h#L526. It does not use filters either.

My suggestion here, in PushInventory or RelayInv is to determine the transaction associated with the Transaction Lock Vote (CTxLockVote) and then call pnode->pfilter->IsRelevantAndUpdate(txlvote.txHash) to determine if that Tx Lock Vote should be sent to that peer in the next inventory message sent.

There may be a better way to achieve this.

Sources:
Dash Wallet: https://github.com/HashEngineering/dash-wallet
dashj: https://github.com/HashEngineering/dashj
BIP37: https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki

@HashEngineering HashEngineering changed the title [feature request] Extend Bloom Filter support to InstantSend related message [feature request] Extend Bloom Filter support to InstantSend related messages Oct 10, 2017
@UdjinM6
Copy link

UdjinM6 commented Mar 6, 2019

Fixed by #2184

@UdjinM6 UdjinM6 closed this as completed Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants