| 643 | } |
| 644 | |
| 645 | static RPCMethod getblocktemplate() |
| 646 | { |
| 647 | return RPCMethod{ |
| 648 | "getblocktemplate", |
| 649 | "If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n" |
| 650 | "It returns data needed to construct a block to work on.\n" |
| 651 | "For full specification, see BIPs 22, 23, 9, and 145:\n" |
| 652 | " https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki\n" |
| 653 | " https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki\n" |
| 654 | " https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n" |
| 655 | " https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n", |
| 656 | { |
| 657 | {"template_request", RPCArg::Type::OBJ, RPCArg::Optional::NO, "Format of the template", |
| 658 | { |
| 659 | {"mode", RPCArg::Type::STR, /* treat as named arg */ RPCArg::Optional::OMITTED, "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"}, |
| 660 | {"capabilities", RPCArg::Type::ARR, /* treat as named arg */ RPCArg::Optional::OMITTED, "A list of strings", |
| 661 | { |
| 662 | {"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "client side supported feature, 'longpoll', 'coinbasevalue', 'proposal', 'serverlist', 'workid'"}, |
| 663 | }}, |
| 664 | {"rules", RPCArg::Type::ARR, RPCArg::Optional::NO, "A list of strings", |
| 665 | { |
| 666 | {"segwit", RPCArg::Type::STR, RPCArg::Optional::NO, "(literal) indicates client side segwit support"}, |
| 667 | {"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "other client side supported softfork deployment"}, |
| 668 | }}, |
| 669 | {"longpollid", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "delay processing request until the result would vary significantly from the \"longpollid\" of a prior template"}, |
| 670 | {"data", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "proposed block data to check, encoded in hexadecimal; valid only for mode=\"proposal\""}, |
| 671 | }, |
| 672 | }, |
| 673 | }, |
| 674 | { |
| 675 | RPCResult{"If the proposal was accepted with mode=='proposal'", RPCResult::Type::NONE, "", ""}, |
| 676 | RPCResult{"If the proposal was not accepted with mode=='proposal'", RPCResult::Type::STR, "", "According to BIP22"}, |
| 677 | RPCResult{"Otherwise", RPCResult::Type::OBJ, "", "", |
| 678 | { |
| 679 | {RPCResult::Type::NUM, "version", "The preferred block version"}, |
| 680 | {RPCResult::Type::ARR, "rules", "specific block rules that are to be enforced", |
| 681 | { |
| 682 | {RPCResult::Type::STR, "", "name of a rule the client must understand to some extent; see BIP 9 for format"}, |
| 683 | }}, |
| 684 | {RPCResult::Type::OBJ_DYN, "vbavailable", "set of pending, supported versionbit (BIP 9) softfork deployments", |
| 685 | { |
| 686 | {RPCResult::Type::NUM, "rulename", "identifies the bit number as indicating acceptance and readiness for the named softfork rule"}, |
| 687 | }}, |
| 688 | {RPCResult::Type::ARR, "capabilities", "", |
| 689 | { |
| 690 | {RPCResult::Type::STR, "value", "A supported feature, for example 'proposal'"}, |
| 691 | }}, |
| 692 | {RPCResult::Type::NUM, "vbrequired", "bit mask of versionbits the server requires set in submissions"}, |
| 693 | {RPCResult::Type::STR, "previousblockhash", "The hash of current highest block"}, |
| 694 | {RPCResult::Type::ARR, "transactions", "contents of non-coinbase transactions that should be included in the next block", |
| 695 | { |
| 696 | {RPCResult::Type::OBJ, "", "", |
| 697 | { |
| 698 | {RPCResult::Type::STR_HEX, "data", "transaction data encoded in hexadecimal (byte-for-byte)"}, |
| 699 | {RPCResult::Type::STR_HEX, "txid", "transaction hash excluding witness data, shown in byte-reversed hex"}, |
| 700 | {RPCResult::Type::STR_HEX, "hash", "transaction hash including witness data, shown in byte-reversed hex"}, |
| 701 | {RPCResult::Type::ARR, "depends", "array of numbers", |
| 702 | { |
nothing calls this directly
no test coverage detected