(timestamp: Timestamp)
| 44 | |
| 45 | export const insertIntoMerkleTree = |
| 46 | (timestamp: Timestamp) => |
| 47 | (tree: MerkleTree): MerkleTree => { |
| 48 | const key = timestampToKey(timestamp); |
| 49 | const hash = timestampToHash(timestamp); |
| 50 | // @ts-expect-error undefined is OK |
| 51 | return insertKey({ ...tree, hash: tree.hash ^ hash }, key, hash); |
| 52 | }; |
| 53 | |
| 54 | const keyToTimestamp = (key: string): Millis => |
| 55 | (parseInt(key.length > 0 ? key : "0", 3) * 1000 * 60) as Millis; |