diff options
author | Yigit Sever | 2022-04-23 11:04:52 +0300 |
---|---|---|
committer | Yigit Sever | 2022-04-23 11:04:52 +0300 |
commit | 647967f271d356c3d309ab24ca96fd09f4c87829 (patch) | |
tree | 7955a4130a9611512ddabfb5d03af2287318aa56 /src | |
parent | 981e340977477d52374458fa9d5a0ac7db62b971 (diff) | |
download | gradecoin-647967f271d356c3d309ab24ca96fd09f4c87829.tar.gz gradecoin-647967f271d356c3d309ab24ca96fd09f4c87829.tar.bz2 gradecoin-647967f271d356c3d309ab24ca96fd09f4c87829.zip |
Add logging to coinbase rewards
Diffstat (limited to 'src')
-rw-r--r-- | src/handlers.rs | 1 | ||||
-rw-r--r-- | src/student.rs | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index e31a4ad..736ad29 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
@@ -553,6 +553,7 @@ pub async fn propose_block( | |||
553 | let coinbase = pending_transactions.get(&new_block.transaction_list[0]).unwrap(); | 553 | let coinbase = pending_transactions.get(&new_block.transaction_list[0]).unwrap(); |
554 | let mut coinbase_user = users_store.get_mut(&coinbase.source).unwrap(); | 554 | let mut coinbase_user = users_store.get_mut(&coinbase.source).unwrap(); |
555 | coinbase_user.balance += BLOCK_REWARD; | 555 | coinbase_user.balance += BLOCK_REWARD; |
556 | debug!("{} block reward went to {:?} for mining the block", BLOCK_REWARD, coinbase_user); | ||
556 | 557 | ||
557 | let mut holding: HashMap<String, Transaction> = HashMap::new(); | 558 | let mut holding: HashMap<String, Transaction> = HashMap::new(); |
558 | 559 | ||
diff --git a/src/student.rs b/src/student.rs index 2b9c5bd..b6d99cd 100644 --- a/src/student.rs +++ b/src/student.rs | |||
@@ -24,6 +24,12 @@ pub struct User { | |||
24 | pub is_bot: bool, | 24 | pub is_bot: bool, |
25 | } | 25 | } |
26 | 26 | ||
27 | impl fmt::Display for User { | ||
28 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
29 | write!(f, "{}", self.user_id) | ||
30 | } | ||
31 | } | ||
32 | |||
27 | #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] | 33 | #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] |
28 | pub struct MetuId { | 34 | pub struct MetuId { |
29 | id: Id, | 35 | id: Id, |