update packages

add some docs
This commit is contained in:
vbodinaud
2021-03-04 15:45:45 +01:00
parent 00bc56adc3
commit 33d508fb44
7 changed files with 216 additions and 5 deletions

View File

@@ -17,16 +17,28 @@ repeat {
print("Enter command:")
command = readLine()
// Create a new block
if command == "create" {
print("data for the new block:")
let data = readLine()
blockchain.createBlock(data: data ?? "")
}
// Create a lot of blocks
if command == "spam" {
for _ in 1...1000 {
blockchain.createBlock(data: "\((blockchain.chain.last?.index ?? 0)+1)")
}
}
// Check validity of the blockchain
if command == "validity" {
blockchain.chainValidity()
}
// Insert a corrupted block
if command == "corrupt" {
blockchain.insertCorruptedBlock()
}
} while command != "exit"