diff options
| author | Yigit Sever | 2021-04-07 04:33:45 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-04-07 04:35:44 +0300 |
| commit | 84d9c14a17e864058527981e3388cef148827c11 (patch) | |
| tree | 19c7b4b4d67d2ba2d3d87ba7eca009ff997e0cd0 /tester.sh | |
| parent | 95ff6371303ac28d05b25fd9f6e436c5d0a58d4c (diff) | |
| download | gradecoin-84d9c14a17e864058527981e3388cef148827c11.tar.gz gradecoin-84d9c14a17e864058527981e3388cef148827c11.tar.bz2 gradecoin-84d9c14a17e864058527981e3388cef148827c11.zip | |
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
Diffstat (limited to 'tester.sh')
| -rw-r--r-- | tester.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tester.sh b/tester.sh new file mode 100644 index 0000000..a0396d6 --- /dev/null +++ b/tester.sh | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | |||
| 3 | ## When in doubt just write a shell script | ||
| 4 | |||
| 5 | curl --request POST \ | ||
| 6 | --header 'Content-Type: application/json' \ | ||
| 7 | --data '{ | ||
| 8 | "source": "foo", | ||
| 9 | "target": "bar", | ||
| 10 | "amount": 5, | ||
| 11 | "timestamp": "2021-04-07T00:17:00" | ||
| 12 | }' \ | ||
| 13 | http://localhost:8080/transaction | ||
| 14 | |||
| 15 | curl --request POST \ | ||
| 16 | --header 'Content-Type: application/json' \ | ||
| 17 | --data '{ | ||
| 18 | "source": "saz", | ||
| 19 | "target": "quux", | ||
| 20 | "amount": 12, | ||
| 21 | "timestamp": "2021-04-07T00:17:00" | ||
| 22 | }' \ | ||
| 23 | http://localhost:8080/transaction | ||
| 24 | |||
| 25 | curl localhost:8080/transaction | ||
| 26 | |||
| 27 | curl --header "Content-Type: application/json" \ | ||
| 28 | --request POST \ | ||
| 29 | --data '{ | ||
| 30 | "transaction_list": [ | ||
| 31 | "foo", | ||
| 32 | "saz" | ||
| 33 | ], | ||
| 34 | "nonce": 4, | ||
| 35 | "timestamp": "2021-04-07T04:17:00", | ||
| 36 | "hash": "aaaaaa" | ||
| 37 | }' \ | ||
| 38 | http://localhost:8080/block | ||
