Skip to content

Added RPC call 'getmemorypool' to get list of transactions that would be - #476

Merged
gavinandresen merged 1 commit into
bitcoin:masterfrom
forrestv:getmemorypool
Oct 1, 2011
Merged

gavinandresen merged 1 commit into
bitcoin:masterfrom
forrestv:getmemorypool

Conversation

@forrestv

Copy link
Copy Markdown
Contributor

Added RPC call 'getmemorypool' to get list of transactions that would be included in a generated block.

This is useful for any program that wants to create its own generation transaction while mining.

P2Pool recently generated its first block, and this patch would let it include transactions.

@gavinandresen

Copy link
Copy Markdown
Contributor

Was there a design discussion for this anywhere?

You're returning more than just the list of transactions, and there is some magic code I don't understand (like the ...GetTime() - nStart > 60 ... what is that about?)

@forrestv

Copy link
Copy Markdown
Contributor Author

There wasn't a discussion - I assumed we'd have it here and I'd revise it.

It also returns the previous block and the total amount of fees in those transactions. The previous block hash is important because these specific transactions are only valid following that block.

The magic code is just a copy of the block caching code from the getwork handler.

@gavinandresen

Copy link
Copy Markdown
Contributor

"If it is a more complicated or potentially controversial change, then the patch submitter will be asked to start a discussion (if they haven't already) on the development forums: http://www.bitcoin.org/smf/index.php?board=6.0 "

... from the top-level README. Please start a discussion on the forums or the bitcoin-dev mailing list.

@TheBlueMatt

Copy link
Copy Markdown
Contributor

you still suggest anyone try to start a sensible discussion on those forums?

@forrestv

Copy link
Copy Markdown
Contributor Author

@nanotube

Copy link
Copy Markdown

by the way, wanted to make a note @gavinandresen : this will also be useful for writing that cross-client test-suite you were talking about.

when we were discussing it, you were primarily focusing on sending client various bits of blockchain. however, as we know from the existing bug where transactions with duplicate inputs are treated as valid for the purposes of rebroadcast, testing the client by sending it a bunch of weird transactions would be good too. and this getmemorypool functionality would let you query the client to see if it has 'accepted' the transaction.

just a thought. :)

@ervwalter

Copy link
Copy Markdown

can you rebase this against 0.4rc?

@forrestv

forrestv commented Sep 5, 2011

Copy link
Copy Markdown
Contributor Author

Rebased.

@goblin

goblin commented Sep 6, 2011

Copy link
Copy Markdown

I'm soooo excited about it! :-D

Thanks to this the awesome decentralized p2pool can now include transactions and make actual use of the mining power :-)
First mined block with transactions: http://blockexplorer.com/b/143923

Thanks

@gavinandresen

Copy link
Copy Markdown
Contributor

I'd like to pull this; can you rebase again?

…struct a block with a custom generation transaction and submit a solution

getmemorypool [data]
If [data] is not specified, returns data needed to construct a block to work on:
  "version" : block version
  "previousblockhash" : hash of current highest block
  "transactions" : contents of non-coinbase transactions that should be included in the next block
  "coinbasevalue" : maximum allowable input to coinbase transaction, including the generation award and transaction fees
  "time" : timestamp appropriate for next block
  "bits" : compressed target of next block
If [data] is specified, tries to solve the block and returns true if it was successful.
@forrestv

forrestv commented Oct 1, 2011

Copy link
Copy Markdown
Contributor Author

Rebased. Thanks!

gavinandresen added a commit that referenced this pull request Oct 1, 2011
Added RPC call 'getmemorypool' for p2p mining pools
@gavinandresen
gavinandresen merged commit ad9ceec into bitcoin:master Oct 1, 2011
coblee referenced this pull request in litecoin-project/litecoin Jul 17, 2012
Added RPC call 'getmemorypool' for p2p mining pools
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants