public void SetLocation(TransactionContext transactionContext, byte[] item, LocationEnum location) { transactionContext.Transaction.Insert <byte[], int>(LOCATIONS, item, (int)location); var block = Get(transactionContext, item).Value; foreach (var txHash in block.TxHashes) { var tx = TxStore.Get(transactionContext, txHash); TxStore.Put(transactionContext, txHash, tx.Value.Tx, false); } }
public Keyed <Types.Block> GetBlock(TransactionContext transactionContext, byte[] key) { var _block = Get(transactionContext, key); if (_block == null) { BlockChainTrace.Information("Block not found: " + Convert.ToBase64String(key)); return(null); } else { var txs = _block.Value.TxHashes.Select(t => TxStore.Get(transactionContext, t).Value).ToList(); var block = new Types.Block(_block.Value.BlockHeader, ListModule.OfSeq <Types.Transaction>(txs.Select(t => t.Tx))); return(new Keyed <Types.Block>(key, block)); } }