Lowered PoW-difficulty

This commit is contained in:
Mawoka
2022-07-05 20:11:12 +02:00
parent 87dba42b57
commit fd3a8bb80b
3 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -88,7 +88,6 @@ class UploadImageReturn(BaseModel):
@router.post("/image", response_model=UploadImageReturn)
async def upload_image(edit_id: str, pow_data: str, file: UploadFile = File()):
print(pow_data)
session_data = await redis.get(f"edit_session:{edit_id}")
pow_data_server = await redis.get(f"edit_session:{edit_id}:pow")
uploaded_images = await redis.llen(f"edit_session:{edit_id}:images")
@@ -97,9 +96,9 @@ async def upload_image(edit_id: str, pow_data: str, file: UploadFile = File()):
if session_data is None:
raise HTTPException(status_code=401, detail="Edit ID not found!")
if uploaded_images == 0 and not check_hashcash(pow_data, pow_data_server, "19"):
if uploaded_images == 0 and not check_hashcash(pow_data, pow_data_server, "16"):
raise HTTPException(status_code=401, detail="Edit ID not found!")
if uploaded_images != 0 and not check_hashcash(pow_data, pow_data_server, "17"):
if uploaded_images != 0 and not check_hashcash(pow_data, pow_data_server, "16"):
raise HTTPException(status_code=401, detail="Edit ID not found!")
file_bytes = await file.read()
if len(file_bytes) < 2000:
+1 -1
View File
@@ -106,7 +106,7 @@
const res = await fetch(`/api/v1/editor/pow?edit_id=${edit_id}`);
const data = (await res.json()).data;
console.log(data);
pow_data = await mint(data);
pow_data = await mint(data, 16);
console.log(pow_data);
};
</script>
+1 -1
View File
@@ -36,7 +36,7 @@
return;
}
console.log('Computing POW');
pow_data = await mint(salt, 17, '', 8, false);
pow_data = await mint(salt, 16, '', 8, false);
pow_salt = undefined;
return;
};