mining.capnp raw

   1  # Copyright (c) 2024 The Limenka developers
   2  # Distributed under the MIT software license, see the accompanying
   3  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
   4  
   5  @0xc77d03df6a41b505;
   6  
   7  using Cxx = import "/capnp/c++.capnp";
   8  $Cxx.namespace("ipc::capnp::messages");
   9  
  10  using Common = import "common.capnp";
  11  using Proxy = import "/mp/proxy.capnp";
  12  $Proxy.include("interfaces/mining.h");
  13  $Proxy.includeTypes("ipc/capnp/mining-types.h");
  14  
  15  interface Mining $Proxy.wrap("interfaces::Mining") {
  16      isTestChain @0 (context :Proxy.Context) -> (result: Bool);
  17      isInitialBlockDownload @1 (context :Proxy.Context) -> (result: Bool);
  18      getTip @2 (context :Proxy.Context) -> (result: Common.BlockRef, hasResult: Bool);
  19      waitTipChanged @3 (context :Proxy.Context, currentTip: Data, timeout: Float64) -> (result: Common.BlockRef);
  20      createNewBlock @4 (options: BlockCreateOptions) -> (result: BlockTemplate);
  21  }
  22  
  23  interface BlockTemplate $Proxy.wrap("interfaces::BlockTemplate") {
  24      destroy @0 (context :Proxy.Context) -> ();
  25      getBlockHeader @1 (context: Proxy.Context) -> (result: Data);
  26      getBlock @2 (context: Proxy.Context) -> (result: Data);
  27      getTxFees @3 (context: Proxy.Context) -> (result: List(Int64));
  28      getTxSigops @4 (context: Proxy.Context) -> (result: List(Int64));
  29      getCoinbaseTx @5 (context: Proxy.Context) -> (result: Data);
  30      getCoinbaseCommitment @6 (context: Proxy.Context) -> (result: Data);
  31      getWitnessCommitmentIndex @7 (context: Proxy.Context) -> (result: Int32);
  32      getCoinbaseMerklePath @8 (context: Proxy.Context) -> (result: List(Data));
  33      submitSolution @9 (context: Proxy.Context, version: UInt32, timestamp: UInt32, nonce: UInt32, coinbase :Data) -> (result: Bool);
  34  }
  35  
  36  struct BlockCreateOptions $Proxy.wrap("node::BlockCreateOptions") {
  37      useMempool @0 :Bool $Proxy.name("use_mempool");
  38      blockReservedWeight @1 :UInt64 $Proxy.name("block_reserved_weight");
  39      coinbaseOutputMaxAdditionalSigops @2 :UInt64 $Proxy.name("coinbase_output_max_additional_sigops");
  40  }
  41  
  42  # Note: serialization of the BlockValidationState C++ type is somewhat fragile
  43  # and using the struct can be awkward. It would be good if testBlockValidity
  44  # method were changed to return validity information in a simpler format.
  45  struct BlockValidationState {
  46      mode @0 :Int32;
  47      result @1 :Int32;
  48      rejectReason @2 :Text;
  49      debugMessage @3 :Text;
  50  }
  51