From 84d9c14a17e864058527981e3388cef148827c11 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Wed, 7 Apr 2021 04:33:45 +0300 Subject: Implement Block GET/PUT with new schema - `Arc`+`Mutex` is replaced by `parking_lot::RwLock,` decoupled Read+Write and ability to upgrade read locks into write locks if needed - Schema has changed, `Db` is now a struct that implements `new()` to return a new instance of itself, pros/cons listed in code but tl;dr blockchain and pending transactions are separate now - `custom_filters` now supports extracting Block json and Transaction json in separate functions too - /block GET and PUT implemented, `Blocks` currently have one check (transactions appear in pending transaction) - debug is working after something, dunno how I fixed it --- tester.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tester.sh (limited to 'tester.sh') diff --git a/tester.sh b/tester.sh new file mode 100644 index 0000000..a0396d6 --- /dev/null +++ b/tester.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +## When in doubt just write a shell script + +curl --request POST \ + --header 'Content-Type: application/json' \ + --data '{ + "source": "foo", + "target": "bar", + "amount": 5, + "timestamp": "2021-04-07T00:17:00" +}' \ + http://localhost:8080/transaction + +curl --request POST \ + --header 'Content-Type: application/json' \ + --data '{ + "source": "saz", + "target": "quux", + "amount": 12, + "timestamp": "2021-04-07T00:17:00" +}' \ + http://localhost:8080/transaction + +curl localhost:8080/transaction + +curl --header "Content-Type: application/json" \ + --request POST \ + --data '{ + "transaction_list": [ + "foo", + "saz" + ], + "nonce": 4, + "timestamp": "2021-04-07T04:17:00", + "hash": "aaaaaa" +}' \ + http://localhost:8080/block -- cgit v1.2.3-70-g09d2