mpt: extend Billet constructor documentation

Billet's mode must match the DB's MPT mode, otherwise Billet-level nodes
decoding won't work properly startign from 86cb4ed8.

Ref.
https://github.com/nspcc-dev/neo-go/pull/3808#issuecomment-2703668032
and 49945e9ae9.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2025-03-06 15:25:23 +03:00
parent 68d7e8e01c
commit 22a5bbcef3

View file

@ -37,7 +37,10 @@ type Billet struct {
// NewBillet returns a new billet for MPT trie restoring. It accepts a MemCachedStore
// to decouple storage errors from logic errors so that all storage errors are
// processed during `store.Persist()` at the caller. Another benefit is
// that every `Put` can be considered an atomic operation.
// that every `Put` can be considered an atomic operation. Note that mode
// parameter must match precisely the Trie mode that is used in the underlying
// DB to store the MPT nodes. Using wrong mode will lead to improper MPT nodes
// decoding and even runtime panic.
func NewBillet(rootHash util.Uint256, mode TrieMode, prefix storage.KeyPrefix, store *storage.MemCachedStore) *Billet {
return &Billet{
TempStoragePrefix: prefix,