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

Bulk Pull by Account Support #988

Closed
rkeene opened this issue Jul 24, 2018 · 3 comments · Fixed by #1039
Closed

Bulk Pull by Account Support #988

rkeene opened this issue Jul 24, 2018 · 3 comments · Fixed by #1039
Assignees
Milestone

Comments

@rkeene
Copy link
Contributor

rkeene commented Jul 24, 2018

Add support for a new bootstrapping command called "bulk_pull_account" which accepts as arguments:

  1. Account (256-bits)
  2. Minimum Pending Amount (128 bits)
  3. Flags (8-bits)

The Account argument is the public key of an account which we are interested in. The "bulk_pull_account" command will request that the remote node return all blocks related to this account. This includes the frontier for the account and information related to transactions destined for that account that have not yet been received with receiving blocks (pending).

The Minimum Pending Amount argument is the minimum amount that must be pending in a single transaction for an account or block hash to be included in the pending result section.

The Flags argument is an enumeration consisting of the following possible values:

  • 0x00: PENDING_HASH_AND_AMOUNT: This option indicates that the result should include the block hash of the sending block and the amount in the pending section;
  • 0x01: PENDING_ADDRESS_ONLY: This option indicates that the result should only include the sending account public keys in the pending section;
  • 0x02: PENDING_HASH_AMOUNT_AND_ADDRESS (V17.0+): This option indicates the result should include the account sending public key in addition to anything supplied in PENDING_HASH_AND_AMOUNT`

The result will be in the format of

struct frontierInformation {
        blockHash_t frontierHash
        rawAmount_t frontierBalance
}
union pending {
     /* When Flags == PENDING_ADDRESS_ONLY */
     struct addressOnly[] {
          address_t sendingAccount
     }
     /* When Flags == PENDING_HASH_AND_AMOUNT */
     struct hashBalanceTuple[] {
          blockHash_t sendingBlockHash
          rawAmount_t sendingBlockAmount
     }
     /* When Flags == PENDING_HASH_AMOUNT_AND_ADDRESS */
     struct hashBalanceAddressTuple[] {
          blockHash_t sendingBlockHash
          rawAmount_t sendingBlockAmount
          address_t sendingAccount
     }
}

Where blockHash_t and address_t are a 256-bit bitfield, and rawAmount_t is a 128-bit bitfield.

The pending section will terminate with a final entry where all entries have a value of 0. That is, for the case where the PENDING_ADDRESS_ONLY option is selected the result will terminate with a value of a 256-bits 0. If the PENDING_HASH_AND_AMOUNT option is selected the result will terminate with a value of 384 (256+128) bits of 0. If the PENDING_HASH_AMOUNT_AND_ADDRESS option is selected the result will terminate with a value of 640 (256+128+256) bits of 0.

@rkeene rkeene added this to the V15.0 milestone Jul 24, 2018
@rkeene rkeene self-assigned this Jul 24, 2018
@slact
Copy link
Contributor

slact commented Jul 24, 2018

Yes!

@inkeliz
Copy link

inkeliz commented Aug 30, 2018

Wait. There's a new field, Flags (8-bits)? Why create a Flag when already have the Extesions (16-bit) in the header?

@rkeene
Copy link
Contributor Author

rkeene commented Sep 7, 2018

@inkeliz Because if we use extension bits for this then those bits cannot be used for many things since those things may apply also to bulk_pull_account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants