From ab19740c94aba6a3008981aee66af80843cdc1c3 Mon Sep 17 00:00:00 2001 From: carla Date: Thu, 28 May 2020 09:07:31 +0200 Subject: [PATCH] wtxmgr: extract label deserialization into separate function Requrired so that we can use the same logic in dropwtxmgr. --- wtxmgr/tx.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wtxmgr/tx.go b/wtxmgr/tx.go index 8c9e574..9674c9a 100644 --- a/wtxmgr/tx.go +++ b/wtxmgr/tx.go @@ -1025,6 +1025,12 @@ func FetchTxLabel(ns walletdb.ReadBucket, txid chainhash.Hash) (string, error) { return "", ErrTxLabelNotFound } + return DeserializeLabel(v) +} + +// DeserializeLabel reads a deserializes a length-value encoded label from the +// byte array provided. +func DeserializeLabel(v []byte) (string, error) { // If the label is empty, return an error. length := binary.BigEndian.Uint16(v[0:2]) if length == 0 {