Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
tdelabro committed Sep 5, 2024
1 parent 7bfbecd commit b155ee3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/storage/storage.zig
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ pub const Storage = struct {
}
};

// A Storage transaction
pub const Transaction = struct {
txn: lmdb.Transaction,

// Abandon the Transaction without applying any change
pub fn abort(self: Transaction) void {
self.txn.abort();
}

// Serialize and store a block in database
pub fn store_block(allocator: std.mem.Allocator, txn: Transaction, block: *Block) !void {
const blocks = try txn.txn.database("blocks", .{ .create = true });
try blocks.set(&block.hash, try block.serizalize(allocator));
Expand Down
1 change: 1 addition & 0 deletions src/types/block.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const std = @import("std");

// A bitcoin block with additonal usefull data
pub const Block = struct {
hash: [32]u8,
height: i32,
Expand Down

0 comments on commit b155ee3

Please sign in to comment.