zebra/design/data-flow.md

6.6 KiB

  • Started in ProcessNewBlock, main.cpp:4258
    • Calls CheckBlock, defined at ab2b7c0969/src/main.cpp (L3930)
      • Calls CheckBlockHeader ab2b7c0969/src/main.cpp (L3900)
        • checks that the block version is not too old
          • this requires no information
        • checks that the equihash solution is valid
        • checks that the proof of work parameters are valid
          • requires the current proof of work amount params.powLimit
      • Checks the Merkle root
      • Checks size limits
      • Checks that the first transaction is coinbase, and the rest are not
      • Calls CheckTransaction for each transaction, defined at: ab2b7c0969/src/main.cpp (L1056)
        • is coinbase
        • calls CheckTransactionWithoutProofVerification, defined at: ab2b7c0969/src/main.cpp (L1078)
          • 'Basic checks that don't require any context'
          • With verifier == false, it looks like in this flow
          • Checks a whole bunch of stuff that we check with our semantic representation into structs
            • We should double check that there are no conditions on the values and amounts that we aren't already checking
              • Check for duplicate
                • inputs
                • nullifiers (within a single transaction)
                • // Transactions containing empty vin must have either non-empty vJoinSplit or non-empty vShieldedSpend.
                • // Transactions containing empty vout must have either non-empty vJoinSplit or non-empty vShieldedOutput.
                • Moar: ab2b7c0969/src/main.cpp (L1091)
      • Sum up "LegacySigOps" for each transaction and check that it's less than some maximum
    • Acquires a lock, then calls MarkBlockAsReceived (networking?)
    • Calls AcceptBlock, defined at: ab2b7c0969/src/main.cpp (L4180)
    • Calls CheckBlockIndex, defined at ab2b7c0969/src/main.cpp (L5125)
    • Calls ActivateBestChain, defined at ab2b7c0969/src/main.cpp (L3513)