| 543 | } |
| 544 | |
| 545 | static RPCHelpMan getblocktemplate() |
| 546 | { |
| 547 | return RPCHelpMan{"getblocktemplate", |
| 548 | "\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n" |
| 549 | "It returns data needed to construct a block to work on.\n" |
| 550 | "For full specification, see BIPs 22, 23, 9, and 145:\n" |
| 551 | " https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki\n" |
| 552 | " https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki\n" |
| 553 | " https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n" |
| 554 | " https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n", |
| 555 | { |
| 556 | {"template_request", RPCArg::Type::OBJ, RPCArg::Default{UniValue::VOBJ}, "Format of the template", |
| 557 | { |
| 558 | {"mode", RPCArg::Type::STR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"}, |
| 559 | {"capabilities", RPCArg::Type::ARR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "A list of strings", |
| 560 | { |
| 561 | {"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "client side supported feature, 'longpoll', 'coinbasevalue', 'proposal', 'serverlist', 'workid'"}, |
| 562 | }}, |
| 563 | {"rules", RPCArg::Type::ARR, RPCArg::Optional::NO, "A list of strings", |
| 564 | { |
| 565 | {"segwit", RPCArg::Type::STR, RPCArg::Optional::NO, "(literal) indicates client side segwit support"}, |
| 566 | {"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "other client side supported softfork deployment"}, |
| 567 | }}, |
| 568 | }, |
| 569 | "\"template_request\""}, |
| 570 | }, |
| 571 | { |
| 572 | RPCResult{"If the proposal was accepted with mode=='proposal'", RPCResult::Type::NONE, "", ""}, |
| 573 | RPCResult{"If the proposal was not accepted with mode=='proposal'", RPCResult::Type::STR, "", "According to BIP22"}, |
| 574 | RPCResult{"Otherwise", RPCResult::Type::OBJ, "", "", |
| 575 | { |
| 576 | {RPCResult::Type::NUM, "version", "The preferred block version"}, |
| 577 | {RPCResult::Type::ARR, "rules", "specific block rules that are to be enforced", |
| 578 | { |
| 579 | {RPCResult::Type::STR, "", "name of a rule the client must understand to some extent; see BIP 9 for format"}, |
| 580 | }}, |
| 581 | {RPCResult::Type::OBJ_DYN, "vbavailable", "set of pending, supported versionbit (BIP 9) softfork deployments", |
| 582 | { |
| 583 | {RPCResult::Type::NUM, "rulename", "identifies the bit number as indicating acceptance and readiness for the named softfork rule"}, |
| 584 | }}, |
| 585 | {RPCResult::Type::ARR, "capabilities", "", |
| 586 | { |
| 587 | {RPCResult::Type::STR, "value", "A supported feature, for example 'proposal'"}, |
| 588 | }}, |
| 589 | {RPCResult::Type::NUM, "vbrequired", "bit mask of versionbits the server requires set in submissions"}, |
| 590 | {RPCResult::Type::STR, "previousblockhash", "The hash of current highest block"}, |
| 591 | {RPCResult::Type::ARR, "transactions", "contents of non-coinbase transactions that should be included in the next block", |
| 592 | { |
| 593 | {RPCResult::Type::OBJ, "", "", |
| 594 | { |
| 595 | {RPCResult::Type::STR_HEX, "data", "transaction data encoded in hexadecimal (byte-for-byte)"}, |
| 596 | {RPCResult::Type::STR_HEX, "txid", "transaction id encoded in little-endian hexadecimal"}, |
| 597 | {RPCResult::Type::STR_HEX, "hash", "hash encoded in little-endian hexadecimal (including witness data)"}, |
| 598 | {RPCResult::Type::ARR, "depends", "array of numbers", |
| 599 | { |
| 600 | {RPCResult::Type::NUM, "", "transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is"}, |
| 601 | }}, |
| 602 | {RPCResult::Type::NUM, "fee", "difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one"}, |
nothing calls this directly
no test coverage detected