File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -114,11 +114,12 @@ function createBlocksContent(){
114114 $ content ["blocks " ][$ block ["height " ]]["timeago " ] = round ((time () - $ block ["time " ])/60 );
115115 $ content ["blocks " ][$ block ["height " ]]["coinbasetx " ] = $ block ["tx " ][0 ];
116116 $ coinbaseTx = $ bitcoind ->getrawtransaction ($ block ["tx " ][0 ], 1 , $ block ["hash " ]);
117- if ($ coinbaseTx ["vout " ][0 ]["value " ] != 0 ){
118- $ content ["blocks " ][$ block ["height " ]]["fees " ] = round ($ coinbaseTx ["vout " ][0 ]["value " ] - (50 / pow (2 , floor ($ block ["height " ] / 210000 ))), 4 ) ;
119- }else {
120- $ content ["blocks " ][$ block ["height " ]]["fees " ] = round ($ coinbaseTx ["vout " ][1 ]["value " ] - (50 / pow (2 , floor ($ block ["height " ] / 210000 ))), 4 ) ;
121- }
117+ $ currentReward = 50 / pow (2 , floor ($ block ["height " ] / 210000 ));
118+ $ accuReward = 0 ;
119+ foreach ($ coinbaseTx ["vout " ] as $ vout ){
120+ $ accuReward += $ vout ["value " ];
121+ }
122+ $ content ["blocks " ][$ block ["height " ]]["fees " ] = round ($ accuReward - $ currentReward , 4 );
122123 $ content ["totalFees " ] += $ content ["blocks " ][$ block ["height " ]]["fees " ];
123124 $ content ["blocks " ][$ block ["height " ]]["txcount " ] = count ($ block ["tx " ]);
124125 $ content ["totalTx " ] += $ content ["blocks " ][$ block ["height " ]]["txcount " ];
You can’t perform that action at this time.
0 commit comments