Add graffiti cli flag to the validator client. (#1425)

## Issue Addressed

#1419

## Proposed Changes

Creates a `--graffiti` cli flag in the validator client. If the flag is set, it overrides graffiti in the beacon node. 

## Additional Info
This commit is contained in:
realbigsean
2020-08-11 02:16:29 +00:00
parent 95b55d7170
commit ec84183e05
9 changed files with 125 additions and 21 deletions

View File

@@ -1,4 +1,6 @@
use crate::helpers::{check_content_type_for_json, publish_beacon_block_to_network};
use crate::helpers::{
check_content_type_for_json, parse_hex_ssz_bytes, publish_beacon_block_to_network,
};
use crate::response_builder::ResponseBuilder;
use crate::{ApiError, ApiResult, NetworkChannel, UrlQuery};
use beacon_chain::{
@@ -288,8 +290,14 @@ pub fn get_new_beacon_block<T: BeaconChainTypes>(
let slot = query.slot()?;
let randao_reveal = query.randao_reveal()?;
let validator_graffiti = if let Some((_key, value)) = query.first_of_opt(&["graffiti"]) {
Some(parse_hex_ssz_bytes(&value)?)
} else {
None
};
let (new_block, _state) = beacon_chain
.produce_block(randao_reveal, slot)
.produce_block(randao_reveal, slot, validator_graffiti)
.map_err(|e| {
error!(
log,